/*
 * @version: 1.0.0
 * @Author: fl
 * @Date: 2020-07-06 11:50:33
 * @LastEditTime: 2020-09-08 17:54:24
 */
import { defaultHandler } from '@/utils/request';
import { userbd } from '@/api/home';
import Paging from '@/utils/paging';
import Taro from '@tarojs/taro';

const initialPaging = Paging.initialValue();

export default {
  namespaced: true,
  state: {
    bd:''
  },
  mutations: {
  
    bd(state, data) {
      const { bd = '' } = data.data;
      state.bd = bd;
      Taro.setStorageSync('bd', bd)
    },
    isbd(state, data) {
      console.log('我执行了');
      let isbd =Taro.getStorageSync('bd')
      if (isbd) {
        state.bd = 1;
      }
      // const { bd = '' } = data.data;
      // state.bd = bd;
      // Taro.setStorageSync('bd', bd)
    },
  },
  actions: {
      
    binding({ commit }, params = {gsid:""}) {
      return userbd(params)
        .then(data => commit('bd', data))
        .catch(defaultHandler);
    },
  },
};
